-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix: respect enableReasoningEffort setting when determining reasoning usage #7049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… usage - Modified shouldUseReasoningEffort to return false when enableReasoningEffort is explicitly set to false - This ensures reasoning is disabled when the setting is false, regardless of reasoningEffort value - Added comprehensive tests to verify the fix Fixes #7048
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewing my own code because apparently I trust no one, not even myself.
}): boolean => { | ||
// If enableReasoningEffort is explicitly set to false, reasoning should be disabled | ||
if (settings?.enableReasoningEffort === false) { | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? When enableReasoningEffort
is undefined
(not explicitly set), reasoning can still be enabled if other conditions are met. Should we consider treating undefined
the same as false
for a more conservative approach, or is the current behavior where only an explicit false
disables reasoning the desired one?
@@ -63,7 +63,17 @@ export const shouldUseReasoningEffort = ({ | |||
}: { | |||
model: ModelInfo | |||
settings?: ProviderSettings | |||
}): boolean => (!!model.supportsReasoningEffort && !!settings?.reasoningEffort) || !!model.reasoningEffort | |||
}): boolean => { | |||
// If enableReasoningEffort is explicitly set to false, reasoning should be disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a JSDoc comment above the function to document the precedence rules. This would help future developers understand that enableReasoningEffort: false
takes absolute precedence over all other settings.
reasoningEffort: "medium", | ||
} | ||
|
||
expect(shouldUseReasoningEffort({ model, settings })).toBe(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good test coverage for the explicit false
case! Consider also adding a test for when enableReasoningEffort
is explicitly undefined
(not just missing) to document that this allows reasoning to proceed - this would make the behavior more explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: Matt Rubens <[email protected]>
@roomote-agent Use switch_mode to switch to pr-fixer mode and solve the issues on this PR. Do not create a new one. |
Hi @daniel-lxs! I see your request. I notice the platform unit tests are failing on both Ubuntu and Windows. Let me check out the PR branch and investigate the test failures to fix them. |
…tly false The previous implementation was checking for falsy values (!settings?.enableReasoningEffort) which would return false when enableReasoningEffort was undefined. This broke the expected behavior where reasoning should only be disabled when explicitly set to false. Changed to check for explicit false value (settings?.enableReasoningEffort === false) to ensure reasoning is only disabled when the user explicitly disables it, not when the setting is undefined.
✅ @daniel-lxs The issue has been fixed! Summary of the fix:The problem was in the This broke the expected behavior where reasoning should only be disabled when explicitly set to What was changed:Changed the check from: if (!settings?.enableReasoningEffort) {
return false
} To: if (settings?.enableReasoningEffort === false) {
return false
} This ensures that reasoning is only disabled when the user explicitly sets Test Results:
The fix ensures that the |
Summary
This PR fixes an issue where the
reasoningEffort
parameter would override theenableReasoningEffort
setting, causing reasoning to be enabled even when explicitly disabled.Problem
When
enableReasoningEffort
was set tofalse
in the API configuration, the model would still perform reasoning ifreasoningEffort
(e.g., "medium") was present. This behavior was unexpected as theenableReasoningEffort
setting should take precedence.Solution
Modified the
shouldUseReasoningEffort
function insrc/shared/api.ts
to:enableReasoningEffort
is explicitly set tofalse
false
immediately, disabling reasoning regardless of other settingsTesting
enableReasoningEffort
isfalse
Related Issue
Fixes #7048
Important
Fixes
shouldUseReasoningEffort
inapi.ts
to respectenableReasoningEffort
setting, ensuring reasoning is disabled when explicitly set tofalse
.shouldUseReasoningEffort
inapi.ts
to respectenableReasoningEffort
setting.false
ifenableReasoningEffort
isfalse
, regardless ofreasoningEffort
value.api.spec.ts
to verify behavior whenenableReasoningEffort
isfalse
.enableReasoningEffort
isfalse
, even ifreasoningEffort
is set.This description was created by
for a81fd3c. You can customize this summary. It will automatically update as commits are pushed.